#include "Data.h"
#include "ReaderThread.h"
#include "WriterThread.h"

int main()
{
    Data* data = new Data(10);

    ReaderThread* r1 = new ReaderThread(data);
    ReaderThread* r2 = new ReaderThread(data);
    ReaderThread* r3 = new ReaderThread(data);
    ReaderThread* r4 = new ReaderThread(data);
    ReaderThread* r5 = new ReaderThread(data);
    ReaderThread* r6 = new ReaderThread(data);
    WriterThread* w1 = new WriterThread(data, "ABCDEFGHIJKLMNOPQTSTUVWXYZ");
    WriterThread* w2 = new WriterThread(data, "abcdefghijklmnopqrstuvwxyz");

    r1->start();
    r2->start();
    r3->start();
    r4->start();
    r5->start();
    r6->start();
    w1->start();
    w2->start();

    r1->wait();
    r2->wait();
    r3->wait();
    r4->wait();
    r5->wait();
    r6->wait();
    w1->wait();
    w2->wait();

    delete r1;
    delete r2;
    delete r3;
    delete r4;
    delete r5;
    delete r6;
    delete w1;
    delete w2;

    delete data;
    
    return 0;
}